﻿Imports System.Data.OleDb
Public Class sms_money_data
    Inherits System.Web.UI.Page



    Dim idinfo As Integer
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub



    Protected Sub DropDownList1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DropDownList1.SelectedIndexChanged
        idinfo = DropDownList1.SelectedValue

    End Sub


    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click



        ' New Code - sms_money_data.aspx.vb - 12 Jan 2014 - Gene Da Rocha - Adding New Data to SMS_DATA table.

        Dim oleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("ConnectionString004").ConnectionString)
        Dim SqlString As String = "Insert into sms_moneydata(moneytype_fkid,moneysubtype_fkid,Company_Name,location,stars,description,Contact_Details,picture,company_url) Values(@f1,@f2,@f3,@f4,@f5,@f6,@f7,@f8,@f9)"
        Dim cmd As OleDbCommand = New OleDbCommand(SqlString, oleDbConn)

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

        '' to double test and fix...


        If FileUpload1.HasFile Then
            Try
                FileUpload1.SaveAs("C:\Uploads\" & _
                    FileUpload1.FileName)
                Label1.Text = "File name: " & _
                    FileUpload1.PostedFile.FileName & "<br>" & _
                    "File Size: " & _
                    FileUpload1.PostedFile.ContentLength & "<br>" & _
                    "Content type: " & _
                    FileUpload1.PostedFile.ContentType & "<br>" & _
                    "Location Saved: C:\Uploads\" & _
                    FileUpload1.FileName
            Catch ex As Exception
                Label1.Text = "ERROR: " & ex.Message.ToString()
            End Try
        Else
            Label1.Text = "You have not specified a file."
        End If
    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        If FileUpload1.HasFile Then
            Try
                FileUpload1.SaveAs("C:\Uploads\" & _
                    FileUpload1.FileName)
                Label1.Text = "File name: " & _
                    FileUpload1.PostedFile.FileName & "<br>" & _
                    "File Size: " & _
                    FileUpload1.PostedFile.ContentLength & "<br>" & _
                    "Content type: " & _
                    FileUpload1.PostedFile.ContentType & "<br>" & _
                    "Location Saved: C:\Uploads\" & _
                    FileUpload1.FileName
            Catch ex As Exception
                Label1.Text = "ERROR: " & ex.Message.ToString()
            End Try
        Else
            Label1.Text = "You have not specified a file."
        End If
    End Sub

        cmd.Parameters.AddWithValue("@f1", DropDownList1.SelectedValue)
        cmd.Parameters.AddWithValue("@f2", DropDownList2.SelectedValue)
        cmd.Parameters.AddWithValue("@f3", Company_Name.Text)
        cmd.Parameters.AddWithValue("@f4", location.Text)
        txtboxtmp.value = idinfo
        cmd.Parameters.AddWithValue("@f5", stars.Text)
        cmd.Parameters.AddWithValue("@f6", description.Text)
        cmd.Parameters.AddWithValue("@f7", contact_details.Text)
        cmd.Parameters.AddWithValue("@f8", picture.Text)
        cmd.Parameters.AddWithValue("@f9", company_url.Text)
        oleDbConn.Open()
        cmd.ExecuteNonQuery()
        oleDbConn.Close()
        labelrecord.Text = "Record Added"
        Company_Name.Text = ""
        location.Text = ""
        stars.Text = ""
        description.Text = ""
        contactdetails.Text = ""
        picture.Text = ""
        company_url.text = ""
        Response.Redirect("sms_info_about.aspx")



    End Sub

    Protected Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton1.CheckedChanged
        idinfo = 1
    End Sub

    Protected Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton1.CheckedChanged
        idinfo = 2
    End Sub

    Protected Sub RadioButton3_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton1.CheckedChanged
        idinfo = 3
    End Sub

    Protected Sub RadioButton4_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton1.CheckedChanged
        idinfo = 4
    End Sub

    Protected Sub RadioButton5_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton1.CheckedChanged
        idinfo = 5
    End Sub

    Protected Sub about_image2_TextChanged(sender As Object, e As EventArgs)

    End Sub
End Class